Vue.component("my-header", {
    template: `
    <div>
    <div id="top"> 
   <span><a href="https://www.dygang.org/" target="_blank"> <font color="#3333cc">手机版 </font></a>| <a href="#" onclick="javascript:window.external.AddFavorite('www.dygangs.com', 'http://www.dygangs.com/')" target="_self">加入收藏</a> |<a href="e/tool/gbook/?bid=1" target="_blank">访客留言</a></span> 
   <font color="#000000">请大家使用www.dygangs.com访问电影港,谢谢.</font>|
   <template v-for="l in searchs">
   <a :href="'http://www.dygangs.com/e/search/result/?searchid='+l.sn" target="_blank"> <font color="#3333cc">{{l.name}} </font></a>
   <font color="#3333cc"> </font>|
   </template>
  </div> 
  <table cellspacing="0" cellpadding="2" width="980" align="center" border="0"> 
   <tbody> 
    <tr> 
     <td width="207" height="60"> <a href="/dygang_war/"> <img src="res/images/logo.gif" border="0"> </a> </td> 
     <td width="773" colspan="2"> 
      <div> 
      </div> </td> 
    </tr> 
   </tbody>
  </table>     
  <table height="2" cellspacing="0" cellpadding="2" width="980" align="center" border="0"> 
   <tbody> 
    <tr> 
     <td class="nav-line"></td> 
    </tr> 
   </tbody> 
  </table> 
  <table cellspacing="0" cellpadding="2" width="980" align="center" border="0"> 
   <tbody> 
    <tr> 
     <td class="bg-fleet"> &nbsp;&nbsp;&nbsp; <a href="/">首页</a> |
      <template v-for="c in cates">
      <a :href="'search.html?category=' + c.sn">{{c.name}}</a> |
      </template>
      <a href="/gp/20181022/41407.htm" target="_blank">[本站教程]</a> </td>
    </tr> 
   </tbody> 
  </table> 
  <table width="980" align="center"> 
   <tbody>
    <tr>
     <td></td> 
    </tr>
   </tbody>
  </table> 
  <form action="search.html" method="get" name="searchform" id="searchform">
  <table width="978" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#9966FF" class="so" style="border: 1px solid #ccc"> 
   <input type="hidden" name="tempid" value="1">
   <input type="hidden" name="tbname" value="article"> 
   <tbody>
    <tr> 
     <td width="10%" height="28">&nbsp;&nbsp;搜索关键字:</td> 
     <td width="18%" align="left"> <input name="name" type="text" id="keyboard" size="25"> </td> 
     <td width="6%">&nbsp;&nbsp;范 围:</td> 
     <td width="10%"> <select name="show"> <option value="title,smalltext" selected>默认 </option><option value="title">仅搜索标题 </option></select>  </td>
     <td width="5%" align="center" target="_self"> <input class="input-button" type="submit" value="搜索" name="Submit"> </td> 
     <td width="1%"></td> 
     <td width="50%"> 热门搜索：
     <template v-for="i in searchss">
       <a  :href="'http://www.dygangs.com/e/search/result/?searchid='+i.sn" target="_blank">{{i.name}}</a>&nbsp;&nbsp;&nbsp;
       </template>
       <br>
     </td>
    </tr>  
   </tbody>
  </table> 
  </form> 
  </div>  
    `,
    data() {
        return  {
            cates:[],//分类
            searchs:[],//顶端搜索
            searchss:[],//热门搜索
        }
    },
    created(){
        axios.get("QueryCategoryServlets").then(res=>{
            this.cates=res.data;
        });
        axios.get("Get1SearchServlet").then(res=>{
            this.searchs=res.data;
        });
        axios.get("Get2SearchServlet").then(res=>{
            this.searchss=res.data;
        });
    }
})

Vue.component("my-news",{
    template: `
        <table cellspacing="0" cellpadding="2" width="100%" align="center" border="0"> 
         <tbody> 
          <tr> 
           <td valign="top"> 
            <table width="100%" border="0" cellspacing="0" cellpadding="0"> 
             <tbody>
              <tr v-for="i in 4">
               <td v-for="j in 4" v-if="(i-1)*4+(j-1)<news.length" width="25%">
                <table width="136" border="0" cellspacing="2" cellpadding="0"> 
                 <tbody>
                  <tr> 
                   <td width="132"> 
                    <table class="border1" cellspacing="0" cellpadding="3" border="0"> 
                     <tbody>
                      <tr>
                       <td> <a :href="'detail.html?id=' + news[(i-1)*4+(j-1)].id" target="_blank">
                        <img :src="news[(i-1)*4+(j-1)].poster" border="0" width="120" height="150"
                             :alt="news[(i-1)*4+(j-1)].name"> </a> </td>
                      </tr>
                     </tbody>
                    </table>
                    <table border="0" align="center" cellpadding="3" cellspacing="0">
                     <tbody>
                      <tr>
                       <td> <a :href="'detail.html?id=' + news[(i-1)*4+(j-1)].id" target="_blank" class="c2">
                        {{news[(i-1)*4+(j-1)].name}}
                       </a> </td>
                      </tr>
                     </tbody>
                    </table>
                    <table border="0" align="center" cellpadding="3" cellspacing="0">
                     <tbody>
                      <tr>
                       <td>{{news[(i-1)*4+(j-1)].create_date}}</td>
                      </tr>
                     </tbody>
                    </table> </td>
                  </tr>
                 </tbody>
                </table> </td>
              </tr>
             </tbody>
            </table> </td> 
          </tr> 
         </tbody> 
        </table> 
    `,
    props:['category'],
    data() {
        return {
            news: []
        }
    },
    created() {
        axios.get("QueryMovieNewsServlet?category="+this.category).then(res=>{
            this.news=res.data;
        });
    }
})

Vue.component("my-news1",{
    template:`
         <table width="98%" border="0" cellpadding="0" cellspacing="0" class="box"> 
       <tbody>
        <tr> 
         <td> 
          <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table-title"> 
           <tbody>
            <tr> 
             <td align="middle" width="183" class="mtl"> 
              <div align="left"> 
               <a :href="'http://www.dygangs.com/'+cate.sn+'/'">{{cate.name}}</a> 
              </div> </td> 
             <td align="right" width="265" class="more"> <a :href="'http://www.dygangs.com/'+cate.sn+'/'">更多...</a> </td> 
            </tr> 
           </tbody>
          </table> </td> 
        </tr> 
        <tr> 
         <td> 
          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="btxt"> 
           <tbody>
                <tr v-for="i in 3">
                 <td v-for="j in 2" width="34%" v-if="(i-1)*2+(j-1)<news1.length"> ·
                  <a :href="'detail.html?id=' + news1[(i-1)*2+(j-1)].id" target="_blank"
                     :alt="news1[(i-1)*2+(j-1)].name">{{news1[(i-1)*2+(j-1)].name.substring(0,10)}}
                </a> <br> </td>
                </tr>
               </tbody>
          </table> </td> 
        </tr> 
       </tbody>
      </table> 
    `,
    props: ['category','id'],
    data(){
        return{
            news1:[],
            cate:{}
        }
    },
    created(){
        axios.get("QueryMovieNews1Servlet?category="+this.category).then(res=>{
            this.news1=res.data;
        });
        axios.get("QueryCategoryServlet?id="+this.id).then(res=>{
            this.cate=res.data;
        });
    }
})
